import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {IndexComponent} from './index/index.component';
import {UserIndexComponent} from './user/user-index/user-index.component';
import {AuthGuard} from './auth_guard';
import {LoginComponent} from './user/login/login.component';
import {RegisterComponent} from './user/register/register.component';
import {ListComponent} from './list/list.component';
import {PlayComponent} from './play/play.component';
import {DetailComponent} from './detail/detail.component';

const routes: Routes = [
    {path: '', component: IndexComponent},
    {path: 'user/index', component: UserIndexComponent, canActivate: [AuthGuard]},
    {path: 'user/login', component: LoginComponent},
    {path: 'user/register', component: RegisterComponent},
    {path: 'video/index', component: ListComponent},
    {path: 'video/:id', component: PlayComponent},
    {path: 'clips/index', component: ListComponent},
    {path: 'clips/:id', component: PlayComponent},
    {path: 'image/index', component: ListComponent},
    {path: 'image/:id', component: DetailComponent},
    {path: 'girls/index', component: ListComponent},
    {path: 'girls/:id', component: DetailComponent},
    {path: '**', component: IndexComponent}
];

@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule {
}
